import service from "@/utils/request";

// 分页获取用户列表信息
export const getUserList = (params) => {
  return service({
    url: "/user/getList",
    method: "get",
    params,
  });
};

export const firstByLikePhone = (params) => {
  return service({
    url: "/user/firstByLikePhone",
    method: "get",
    params,
  });
};

// 根据机构ID获取角色列表-分页
export const getRoleList = (params) => {
  return service({
    url: "/role/getList",
    method: "get",
    params,
  });
};

// 根据机构ID获取角色列表-不分页
export const getAllRoles = (params) => {
  return service({
    url: "/role/find",
    method: "get",
    params,
  });
};

// 添加用户信息
export const createUser = (data) => {
  return service({
    url: "/user/create",
    method: "post",
    data,
  });
};

// 更新用户信息
export const updateUser = (data) => {
  return service({
    url: "/user/update",
    method: "put",
    data,
  });
};

// 删除用户信息
export const deleteUser = (data) => {
  return service({
    url: "/user/delete",
    method: "delete",
    data,
  });
};

// 获取用户当前角色列表
export const getRolesList = (params) => {
  return service({
    url: "/user/first",
    method: "get",
    params,
  });
};

// 当前登陆用户切换角色登陆
export const cutover = (data) => {
  return service({
    url: "/user/cutover",
    method: "post",
    data,
  });
};
